<%-- 
    Document   : vidiGiSiteTermini
    Created on : 17.5.2011, 19:42:
    Author     : Ruzin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="com.zproekt.entity.Pacient" %>
<%@page import="com.zproekt.entity.Termin" %>
<%@page import="com.zproekt.servis.OrdinacijaCRUD" %>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link rel="stylesheet" type="text/css" href="style.css" />

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Сите термини</title>
        </head>
        <body>
            <div class="head">
               <div class="text">
                    Добродојдовте на страната на стоматолошката ординација
                    
                </div>
                <div class="logo"></div>
             </div>  
            <%
                if (request.getSession().getValue("permisija") == null) {
                    response.sendRedirect("index.jsp?error=true");
                }
                String permisija = request.getSession().getValue("permisija").toString();
                if (permisija.equals("user") || permisija.isEmpty()) {
                    response.sendRedirect("user.jsp?error=true");
                }
                // out.println("<h2>"+permisija+"</h2>");
%>
            <% java.util.List<Termin> lista = OrdinacijaCRUD.getAllTermini();
                pageContext.setAttribute("termini", lista);
            %>

            <h1><h:outputText value="Сите термини"/></h1>
            <table border="1">
                <tr>
                    <td>Датум</td>
                    <td>Време</td>
                    <td>Име и Презиме</td>
                    <td>Третман</td>
                    <td>Промена</td>
                </tr>
                <c:forEach var="termin" items="${termini}">
                    <tr>

                        <td>${termin.datum}</td>
                        <td>${termin.vreme}</td>
                        <td>${termin.pacient.getIme()} ${termin.pacient.getPrezime()}</td>
                        <td>${termin.tretman}</td>
                        <td>
                            <form action="izmeniTermin.jsp">
                                <input type="text" name="datum" value="${termin.datum}" style="display: none"/>
                                <input type="text" name="vreme" value="${termin.vreme}" style="display: none"/>
                                <input type="text" name="id" value="${termin.id}" style="display: none"/>
                                 <input type="text" name="ime" value="${termin.pacient.getIme()}" style="display: none"/>
                                 <input type="text" name="prezime" value="${termin.pacient.getPrezime()}" style="display: none"/>
                                 <input type="text" name="pacient" value="${termin.pacient.getId()}" style="display: none"/>
                                 <input type="text" name="tretman" value="${termin.tretman}" style="display: none"/>
                                <input type="submit" value="Измени..."/>
                            </form>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <br/>
            <form action="admin.jsp">
                <input type="submit" value="Откажи!"/>
            </form>
            <div class="footer">
                        Copyright Ruzin © 2011
         </div>
        </body>
    </html>
</f:view>
